using System;
using UnityEngine;
using UnityEngine.EventSystems;

namespace Super
{
	public class BtnRightClick : MonoBehaviour, IPointerDownHandler,IPointerUpHandler
	{
		
		
		public Action action;
		private Vector3 oriScale;
		private float scaleFactor = 0.95f;
		
		public void Start()
		{
			oriScale = transform.localScale;
		}
		
		public void OnPointerDown(PointerEventData eventData)
		{
			if (eventData.button != PointerEventData.InputButton.Right) return;
			transform.localScale = oriScale * scaleFactor;
		}

		public void OnPointerUp(PointerEventData eventData)
		{
			if (eventData.button != PointerEventData.InputButton.Right) return;
			action?.Invoke(); // 执行回调函数
			transform.localScale = oriScale;
		}
	}

}

